

package com.c2soft.ncmxtradeX.controller;

import javax.servlet.http.HttpServletRequest;

import lombok.extern.log4j.Log4j2;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;




import com.c2soft.ncmxtradeX.command.WithdrawCommand;

@Log4j2
@Controller
@RequestMapping("/bank")
public class WihdrawlController {
	
	@Value("#{systemProperties['ncmxServer.redirect.url']}")
	private String baseServerUrl;
	
	@Autowired
	private RestTemplate restTemplate;
	
	
	
	@RequestMapping(value = "/withdrawal", method = { RequestMethod.GET,
			RequestMethod.POST }, produces = "application/json")
	@ResponseBody
	public void buy(@RequestBody WithdrawCommand withdraw,HttpServletRequest req) {
		String redirectUrl = baseServerUrl+"bank/withdrawl";
	restTemplate.postForObject(redirectUrl, withdraw, WithdrawCommand.class);
		
	}
	
	
}
